.typing-test {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;

  .typing-test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;

    @media (max-width: 768px) {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  .stats-panel {
    margin-bottom: 24px;
    
    .ant-statistic {
      text-align: center;
      padding: 16px;
      background: #fafafa;
      border-radius: 8px;
      border: 1px solid #f0f0f0;
      transition: all 0.3s ease;

      &:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
      }
    }
  }

  .progress-section {
    margin-bottom: 24px;
    
    .ant-progress {
      .ant-progress-bg {
        transition: all 0.3s ease;
      }
    }
  }

  .text-display {
    margin-bottom: 24px;
    border: 2px solid #d9d9d9;
    border-radius: 8px;
    transition: border-color 0.3s ease;

    &:hover {
      border-color: #40a9ff;
    }

    .test-text {
      font-size: 18px;
      line-height: 1.8;
      font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
      letter-spacing: 0.5px;
      word-break: break-all;
      white-space: pre-wrap;

      .char {
        position: relative;
        transition: all 0.2s ease;

        &.correct {
          background-color: #f6ffed;
          color: #52c41a;
          border-radius: 2px;
        }

        &.incorrect {
          background-color: #fff2f0;
          color: #ff4d4f;
          border-radius: 2px;
          animation: shake 0.3s ease-in-out;
        }

        &.current {
          background-color: #1890ff;
          color: white;
          border-radius: 2px;
          animation: blink 1s infinite;
        }
      }
    }
  }

  .input-section {
    margin-bottom: 24px;

    .typing-input {
      width: 100%;
      min-height: 120px;
      padding: 16px;
      font-size: 16px;
      line-height: 1.6;
      border: 2px solid #d9d9d9;
      border-radius: 8px;
      resize: vertical;
      font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
      transition: all 0.3s ease;

      &:focus {
        border-color: #40a9ff;
        box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        outline: none;
      }

      &:disabled {
        background-color: #f5f5f5;
        cursor: not-allowed;
      }

      &::placeholder {
        color: #bfbfbf;
        font-style: italic;
      }
    }
  }

  .control-buttons {
    text-align: center;
    
    .ant-btn {
      margin: 0 8px;
      height: 40px;
      border-radius: 8px;
      font-weight: 500;
      transition: all 0.3s ease;

      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      }

      &.ant-btn-primary {
        background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
        border: none;

        &:hover {
          background: linear-gradient(135deg, #40a9ff 0%, #1890ff 100%);
        }
      }
    }
  }

  .result-content {
    text-align: center;
    padding: 16px 0;

    .ant-statistic {
      .ant-statistic-content {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
    }
  }

  // 动画效果
  @keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
  }

  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
  }

  // 响应式设计
  @media (max-width: 768px) {
    padding: 16px;

    .stats-panel {
      .ant-col {
        margin-bottom: 16px;
      }
    }

    .text-display {
      .test-text {
        font-size: 16px;
        line-height: 1.6;
      }
    }

    .typing-input {
      font-size: 14px;
      min-height: 100px;
    }

    .control-buttons {
      .ant-btn {
        margin: 4px;
        width: calc(50% - 8px);
      }
    }
  }

  @media (max-width: 480px) {
    .control-buttons {
      .ant-btn {
        width: 100%;
        margin: 4px 0;
      }
    }
  }

  // 暗色主题支持
  [data-theme='dark'] & {
    .stats-panel {
      .ant-statistic {
        background: #1f1f1f;
        border-color: #303030;
        color: #fff;
      }
    }

    .text-display {
      border-color: #303030;
      background: #1f1f1f;

      .test-text {
        color: #fff;

        .char {
          &.correct {
            background-color: #162312;
            color: #73d13d;
          }

          &.incorrect {
            background-color: #2a1215;
            color: #ff7875;
          }

          &.current {
            background-color: #1890ff;
            color: white;
          }
        }
      }
    }

    .typing-input {
      background: #1f1f1f;
      border-color: #303030;
      color: #fff;

      &:focus {
        border-color: #40a9ff;
        box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
      }

      &::placeholder {
        color: #595959;
      }
    }
  }

  // 打印样式
  @media print {
    .control-buttons,
    .typing-test-header > div:last-child {
      display: none;
    }

    .text-display,
    .input-section {
      border: 1px solid #000;
    }
  }
}
